#include "mainwindow.h"
#include "ui_mainwindow.h"


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->showFullScreen();
    CarData aaa;
    ui->widget->setData(aaa);
}

MainWindow::~MainWindow()
{
    delete ui;
}
void MainWindow::on_pushButton_close_clicked()
{
    this->close();
}

void MainWindow::on_pushButton_reset_clicked()
{
    ui->verticalSlider_pwm->setValue(0);
}
void MainWindow::on_verticalSlider_pwm_valueChanged(int value)      //Motor_L
{
    ui->label_pwm->setText(QString::number(value));
    mCar.setPwmMotor_L(value);
    ui->widget->setData(mCar.getData());
}

void MainWindow::on_pushButton_reset_2_clicked()
{
    ui->verticalSlider_pwm_2->setValue(0);
}

void MainWindow::on_verticalSlider_pwm_2_valueChanged(int value)    //Motor_R
{
    ui->label_pwm_2->setText(QString::number(value));
    mCar.setPwmMotor_R(value);
    ui->widget->setData(mCar.getData());
}

void MainWindow::on_pushButton_reset_3_clicked()
{
    ui->verticalSlider_pwm_3->setValue(0);
}
void MainWindow::on_verticalSlider_pwm_3_valueChanged(int value)    //servo_V
{
    ui->label_pwm_3->setText(QString::number(value));
    mCar.setAngleServo_V(value);
    ui->widget->setData(mCar.getData());
}

void MainWindow::on_pushButton_reset_4_clicked()        //servo_H
{
    ui->verticalSlider_pwm_4->setValue(0);
}
void MainWindow::on_verticalSlider_pwm_4_valueChanged(int value)
{
    ui->label_pwm_4->setText(QString::number(value));
    mCar.setAngleServo_H(value);
    ui->widget->setData(mCar.getData());
}
